<template>
	<view class="a" :style="{'height':height+'px'}">
		<view class="rowsb padding">
			<view @click="selectb(index,item.id)" :class="selecta==index?'selectc' : ''" class="nav_adsgfg"
				v-for="(item,index) in consultList" :key="index">{{item.title}}</view>
		</view>


		<view class="consult" v-for="(item,index) in getHomeList" @click="consultDetail(item.id)">
			<image :src="image+item.img" mode="" class="cousult_image"></image>
			<view>
				<view class="cousule_title onelineshow margin-left">{{item.title}}</view>
				<view class="rowsb cousule_bottom padding-bottom">
					<view class="cousule_text">{{item.fb_time}}</view>
					<view class="align-center">
						<image src="/static/icon/icon_liul.png" mode="" class="cousult_icon"></image>
						<text class="cousule_text">{{item.look}}</text>
					</view>
					<view class="align-center">
						<!-- <image src="/static/icon/icon_zan.png" mode="" class="cousult_icon"></image> -->
						<!-- <text class="cousule_text">{{item.is_dz}}</text> -->
					</view>
				</view>
			</view>
		</view>






		<view>
			<rich-text :nodes="getHomeList.content"></rich-text>
		</view>
		<view class=" text-gray padding text-center" v-if="getHomeList==''">
			暂无更多内容
		</view>
	</view>
</template>

<script>
	const app = getApp().globalData
	import {
		consultClassfiy,
		getHomeByid
	} from '../../../common/path.js'
	export default {
		data() {
			return {
				height: 0,
				selecta: 0, //底部导航栏
				consultList: [],
				getHomeList: [], //咨询列表
			}
		},
		onReady() {
			this.height = uni.getSystemInfoSync().windowHeight;

		},
		onLoad() {
			this.image = app.image
			this.consultClassfiy()
		},
		methods: {
			selectb(event, id) { //底部导航栏点击
				if (this.selecta == event) return false
				this.selecta = event
				this.getHomeByid(id)
			},
			//咨询分类
			consultClassfiy() {
				this.$axios.axios('POST', consultClassfiy, {})
					.then(res => {
						console.log("咨询分类", res.data[0].id)
						this.consultList = res.data
						this.getHomeByid(res.data[0].id)
					})
					.catch(err => {
						console.log(err)
					})
			},
			getHomeByid(id) {
				let data = {
					id: id,
					title: ''
				}
				this.$axios.axios('POST', getHomeByid, data)
					.then(res => {
						console.log('咨询列表', res.data)
						if (res.status == 1) {
							this.getHomeList = res.data
						}

					})
			},
			consultDetail(id) {
				uni.navigateTo({
					url: 'consultDetail?id=' + id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.a {
		background-color: #F0F3F6;
		/* height: 1334rpx; */
	}

	.nav_adsgfg {
		font-size: 32rpx;
		/* color: #BBBBBB; */
		font-weight: bold;
	}

	.selectc {
		color: #0054A7;
		font-size: 32rpx;
		/* font-weight: bold; */
		padding-bottom: 20rpx;
		border-bottom: 2rpx solid #0054A7;

	}

	.rowsb {
		font-size: 34rpx;
		background-color: #FFFFFF;
		display: flex;
		justify-content: space-around;
	}

	page {
		background: #F2F2F2;
	}




	.consult {
		width: 750rpx;
		background: #FFFFFF;
		display: flex;
		padding: 20rpx;
		position: relative;

		.cousult_image {
			width: 224rpx;
			height: 172rpx;
			border-radius: 4rpx;
			background-color: #eeeeee;
		}

		.cousule_bottom {
			position: absolute;
			bottom: 0;
			width: 500rpx;

			.cousult_icon {
				width: 30rpx;
				height: 30rpx;
			}

			.cousule_text {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #AEAEAE;
				opacity: 1;
				margin-left: 10rpx;
			}
		}

		.cousule_title {
			width: 456rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #000000;
			opacity: 1;
		}
	}
</style>
